﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.DataBase.Production.Domain
{/// <summary>
/// 废料详细表
/// </summary>
    public class ScrapDetailModel
    {
        [Key]
        public int Id { get; set; }
        /// <summary>
        /// 主表id
        /// </summary>
        public int ScrapFormId  { get; set; }
        /// <summary>
        /// 序号（自动生成）
        /// </summary>
        public int Sequence { get; init; }

        /// <summary>
        /// 产品名称（必填）
        /// </summary>
        [Required]
        public string ProductName { get; set; } = null!;

        /// <summary>
        /// 产品编号（可选）
        /// </summary>
        public string? ProductCode { get; set; }

        /// <summary>
        /// 规格型号（可选）
        /// </summary>
        public string? Specification { get; set; }

        /// <summary>
        /// 单位（默认"个"）
        /// </summary>
        public string Unit { get; set; } 

        /// <summary>
        /// 本次废料数量（必填，需≤可废数量）
        /// </summary>
        [Range(0, int.MaxValue)]
        public int ScrapQuantity { get; set; }

        /// <summary>
        /// 可废数量（自动显示库存可废量）
        /// </summary>
        public int AllowableScrapQuantity { get; init; }

        /// <summary>
        /// 废料原因（必填）
        /// </summary>
        [Required]
        public string ScrapReason { get; set; } = null!;

        /// <summary>
        /// 批号（可选）
        /// </summary>
        public string? BatchNumber { get; set; }

        /// <summary>
        /// 生产日期（必填）
        /// </summary>
        public DateTime ProductionDate { get; set; }

        /// <summary>
        /// 有效日期（必填）
        /// </summary>
        public DateTime ExpiryDate { get; set; }

        /// <summary>
        /// 出库仓库（必填）
        /// </summary>
        [Required]
        public string Warehouse { get; set; } = null!;

        /// <summary>
        /// 关联领料/补料主题（可选）
        /// </summary>
        public string? RelatedReplenishmentTopic { get; set; }

        /// <summary>
        /// 关联项目（可选）
        /// </summary>
        public string? RelatedProject { get; set; }
    }
}
